//
//  ViewController.m
//  layoutMargins
//
//  Created by 李煜 on 2024/1/18.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIView * layoutMarginsView = [[UIView alloc]initWithFrame:self.view.bounds];
    layoutMarginsView.backgroundColor = [UIColor systemOrangeColor];
    [self.view addSubview:layoutMarginsView];
    //设置margin
    layoutMarginsView.layoutMargins = UIEdgeInsetsMake(20, 20, 20, 30);
    
    //添加子视图
    UIView * subView = [[UIView alloc]init];
    subView.backgroundColor = [UIColor systemPinkColor];
    [layoutMarginsView addSubview:subView];
    subView.frame  = subView.superview.bounds;
    subView.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(20, 20, 20, 30);


}


@end
